﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;

namespace ArtClub.App_Code.Session
{
    /// <summary>
    /// AppSession provides a facade to the ASP.NET Session object.
    /// All access to Session variables *must* be through this class.
    /// </summary>
    public static class AppSession
    {

        # region Private Constants
        //---------------------------------------------------------------------
        private const string user = "mysite_user";

        //---------------------------------------------------------------------
        # endregion

        public static void ResetState() //reset the session state
        {
            member = null;
        }


        //
        // READ/WRITE


        /// <summary>
        /// member for the currently logged in user
        /// </summary>
        public static Member member
        {
            get
            {
                if (HttpContext.Current.Session[user] == null)
                {
                    HttpContext.Current.Session[user] = new Member();
                    return (Member)HttpContext.Current.Session[user];
                }
                else
                {
                    return (Member)HttpContext.Current.Session[user];
                }
            }
            set
            {
                HttpContext.Current.Session[user] = value;
            }
        }


        // *** STATIC PROPERTIES ***

       
    }
}